﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.quest.Managers {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;
    import flash.utils.*;
    import Classes.*;
    import Classes.util.*;
    import __AS3__.vec.*;
    import Modules.stats.experiments.*;
    import Display.hud.components.*;
    import Modules.quest.Display.*;
    import Modules.minigames.*;
    import Modules.quest.guide.*;
    import Display.hud.*;

    public class GameQuest extends Quest {

        public static const NEWSPAPER_AUTOPOP_WAIT:int = 1500;
        private static const questDlgDef:QuestGuideDialog = null;
        private static const citNameDlgDef:CityNameDialog = null;
        private static const welcomeTrainDlgDef:WelcomeTrainDialog = null;
        private static const inviteFriendsGuideDlgDef:QuestInviteFriendsGuideDialog = null;
        private static const pictureDlgDef:QuestPictureDialog = null;
        private static const letterDlgDef:QuestLetterDialog = null;
        private static const freegiftsDlgDef:QuestFreeGiftsDialog = null;
        private static const centeredQuestPopup:CenteredQuestPopup = null;
        private static const xpromoDlgDef:QuestXPromoEpilogueDialog = null;
        private static const miniGameCompleteDlg:QuestMiniGameCompleteDialog = null;

        private const EXPIRE:int = 100;
        private const DO_NOT_SHOW_COMPLETE:String = "doNotShowComplete";
        private const INITIAL_BOTHER:int = -1;

        private var m_isActive:Boolean = false;
        private var m_everLookedAt:Boolean = false;
        private var m_botherCount:int = 0;
        private var m_timer:Timer;
        private var m_icon:DisplayObject;
        private var m_iconUrl:String;
        private var m_toolTip:String;
        private var m_customQuestDialog:String = null;
        private var m_customQuestCompleteDialog:String = null;
        private var m_epilogueDialogs:Array;
        private var m_resourceMods:XML;
        private var m_rewardMultiplier:String;
        private var m_rewardMultiplierMax:int;
        protected var m_guide:QuestGuide;
        protected var m_hasIntro:Boolean;
        protected var m_popNews:Boolean = false;
        protected var m_newsImageUrl:String;
        private var m_uxFlags:Array;
        private var m_uxFlagsComplete:Array;
        protected var m_completeWaitTime:Number = 0;
        protected var m_showCompleteDialog:Boolean = true;
        protected var m_arrowPersists:Boolean = false;
        protected var m_autoShowPopup:Boolean = false;
        protected var m_autoShowOnce:Boolean = false;
        protected var m_consumption:XMLList;
        protected var m_hasConsumptions:Boolean = false;
        protected var m_customPickUrl:String;
        protected var m_hideIcon:Boolean = false;
        protected var m_animateIcon:Boolean = false;
        protected var m_animationObject:Object = null;
        protected var m_hasCompleted:Boolean = false;
        protected var m_questUpdatedTime:String;
        protected var m_notifications:Array;
        private var m_introCloseCallback:Function = null;
        private var m_completionCallback:Function = null;

        public function GameQuest(_arg1:XML){
            var attr:* = null;
            var notif:* = null;
            var notifDef:* = null;
            var xml:* = null;
            var introcallbackName:* = null;
            var config:* = _arg1;
            this.m_epilogueDialogs = [];
            this.m_uxFlags = [];
            this.m_uxFlagsComplete = [];
            super(config);
            this.m_iconUrl = super.icon;
            this.m_notifications = [];
            if (config.child("notifications").child("notification").length() > 0){
                for each (notif in config.child("notifications").child("notification")) {
                    notifDef = {};
                    notifDef["type"] = notif.attribute("type").toString();
                    if (notif.attribute("experiment").length() > 0){
                        notifDef["experiment"] = notif.attribute("experiment").toString();
                    };
                    if (notif.attribute("variant").length() > 0){
                        notifDef["variant"] = parseInt(notif.attribute("variant").toString());
                    };
                    this.m_notifications.push(notifDef);
                };
            };
            if ((((config.intro.length() > 0)) && ((config.tasks.task.(@action == "seenQuest").length() > 0)))){
                this.m_hasIntro = true;
            } else {
                this.m_hasIntro = false;
            };
            if (String(config.@popNews) == "true"){
                this.m_popNews = true;
                this.m_newsImageUrl = String(config.@newsImage);
            };
            var enables:* = String(config.@enables);
            if (enables != ""){
                this.m_uxFlags = enables.split(",");
            };
            var completeEnables:* = String(config.@complete_enables);
            if (completeEnables != ""){
                this.m_uxFlagsComplete = completeEnables.split(",");
            };
            this.m_completeWaitTime = m_xml.@completeWaitTime;
            this.m_questUpdatedTime = m_xml.@quest_updated_time;
            this.m_customQuestDialog = m_xml.customDialogs.customQuestDialog.@className;
            this.m_customQuestCompleteDialog = m_xml.customDialogs.customQuestCompleteDialog.@className;
            for each (attr in m_xml.customDialogs.epilogueDialog.@className) {
                this.m_epilogueDialogs.push(attr.toString());
            };
            if (this.m_customQuestCompleteDialog == this.DO_NOT_SHOW_COMPLETE){
                this.m_showCompleteDialog = false;
            };
            this.m_rewardMultiplier = String(m_xml.resourceModifiers.@rewardMultiplier);
            this.m_rewardMultiplierMax = int(m_xml.resourceModifiers.@rewardMultiplierMax);
            if (this.m_rewardMultiplierMax < 1){
                this.m_rewardMultiplierMax = 1;
            };
            this.m_resourceMods = m_xml.resourceModifiers.questRewards[0];
            this.m_consumption = m_xml.consumption.item;
            if (((!((this.m_consumption == null))) && ((this.m_consumption.length() > 0)))){
                this.m_hasConsumptions = true;
            };
            var taskIdx:* = 0;
            while (taskIdx < config.tasks.task.length()) {
                xml = m_xml.tasks.task[taskIdx];
                if (xml.@guide != null){
                    tasks[taskIdx].guide = xml.@guide;
                };
                if (xml.@pick_url != null){
                    this.m_customPickUrl = xml.@pick_url;
                };
                taskIdx = (taskIdx + 1);
            };
            this.m_guide = new QuestGuide(config, this);
            this.m_botherCount = this.INITIAL_BOTHER;
            Global.player.numQuestsLoading = (Global.player.numQuestsLoading + 1);
            this.m_timer = new Timer(this.EXPIRE, 0);
            this.m_timer.addEventListener(TimerEvent.TIMER, this.onActivationTimerComplete);
            this.m_timer.start();
            this.m_arrowPersists = (String(m_xml.@arrowPersists) == "true");
            this.m_autoShowPopup = (String(m_xml.@autoShowPopup) == "true");
            this.m_autoShowOnce = (String(m_xml.@autoShowOnce) == "true");
            this.m_animateIcon = (String(m_xml.@animateIcon) == "true");
            if (this.m_animateIcon){
                this.m_animationObject = new Object();
                this.m_animationObject.numFrames = int(m_xml.@numFrames);
                this.m_animationObject.frameWidth = int(m_xml.@frameWidth);
                this.m_animationObject.frameHeight = int(m_xml.@frameHeight);
                this.m_animationObject.fps = int(m_xml.@fps);
            };
            if (Global.experimentManager.filterXmlByExperiment(new XMLList(m_xml)).length() == 0){
                this.m_hideIcon = true;
            };
            if (((!((m_xml.child("intro") == null))) && ((m_xml.child("intro").length() > 0)))){
                introcallbackName = ((String(m_xml.intro.@introCloseCallback).length > 0)) ? String(m_xml.intro.@introCloseCallback) : null;
                this.m_introCloseCallback = (introcallbackName) ? GameQuestCallbacks[introcallbackName] : null;
            };
            if (String(m_xml.@onComplete).length != 0){
                this.m_completionCallback = ((GameQuestCallbacks[String(m_xml.@onComplete)] is Function)) ? GameQuestCallbacks[String(m_xml.@onComplete)] : null;
            };
        }
        private function onActivationTimerComplete(_arg1:TimerEvent=null):void{
            var _local2:Object;
            var _local3:String;
            if (this.m_timer != null){
                this.m_timer.stop();
                this.m_timer.removeEventListener(TimerEvent.TIMER, this.onActivationTimerComplete);
                this.m_timer = null;
            };
            if (this.m_hasIntro){
                _local2 = Global.questManager.getQuestProgressByName(this.name);
                if (((!((m_xml.intro.@questIconUrl == ""))) && (!(this.hasDoneTask("seenQuest", m_xml.tasks.task, _local2.progress))))){
                    this.m_iconUrl = m_xml.intro.@questIconUrl;
                };
            };
            if (((this.icon) && (!((this.icon == ""))))){
                _local3 = Global.getAssetURL(this.icon);
                LoadingManager.load(_local3, this.onIconLoaded);
            } else {
                Global.player.numQuestsLoading = (Global.player.numQuestsLoading - 1);
            };
        }
        public function getToolTipText():String{
            var _local4:Object;
            var _local1:Object = Global.questManager.getQuestProgressByName(this.name);
            var _local2 = (_local1 == null);
            var _local3 = "";
            if (((this.visible) && (!(_local2)))){
                _local4 = Global.questManager.getLocObjects();
                _local3 = ZLoc.t("Quest", (this.name + "_goal"), _local4);
            };
            return (_local3);
        }
        public function getProgressStrings():Array{
            var _local5:Object;
            var _local6:int;
            var _local7:int;
            var _local1:Array = new Array();
            var _local2:Object = Global.questManager.getQuestProgressByName(this.name);
            var _local3 = (_local2 == null);
            var _local4 = "";
            if (((this.visible) && (!(_local3)))){
                _local5 = Global.questManager.getLocObjects();
                _local6 = 0;
                _local7 = 0;
                while (_local7 < 4) {
                    if (_local2.progress[_local6] != null){
                        _local4 = (_local4 + ZLoc.t("Quest", ((this.name + "_task") + (_local7 + 1)), _local5));
                        if ((((this.tasks[_local7].action == "seenQuest")) || ((this.tasks[_local7].action == "popNews")))){
                            _local6++;
                        };
                        _local4 = (_local4 + (((": " + Math.min(_local2.progress[_local6], this.tasks[_local6].total)) + "/") + this.tasks[_local6].total));
                        _local1.push(_local4);
                        _local4 = "";
                    };
                    _local6++;
                    _local7++;
                };
            };
            return (_local1);
        }
        private function onIconLoaded(_arg1:Event):void{
            var _local3:HUDQuestManagerComponent;
            Global.player.numQuestsLoading = (Global.player.numQuestsLoading - 1);
            var _local2:Loader = (_arg1.target.loader as Loader);
            this.m_toolTip = this.getToolTipText();
            this.m_icon = _local2.content;
            this.addToQuestBar();
            this.updateProgressFlag();
            this.checkBotherTimer();
            if (Global.player.numQuestsLoading <= 0){
                _local3 = (Global.hud.getComponent(HUD.COMP_QUESTS) as HUDQuestManagerComponent);
                if (!_local3){
                    return;
                };
                _local3.updateQuestUI();
            };
        }
        protected function showInitialGoalOverlay():void{
            var _local1:String;
            var _local2:String;
            if (Global.player.allowQuests()){
                _local2 = this.getNotificationOverlayType();
                if ((((Global.player.getLastActivationTime(name) == -1)) || (this.m_arrowPersists))){
                    _local1 = this.getProgressOverlayType();
                    if (_local2){
                        _local1 = _local2;
                    };
                } else {
                    if (this.hasBeenUpdated()){
                        _local1 = this.getUpdateOverlayType();
                    } else {
                        if (_local2){
                            _local1 = _local2;
                        };
                    };
                };
                if (_local1){
                    Global.player.setLastActivationTime(name, int((GlobalEngine.getTimer() / 1000)));
                    Global.hud.showGoalsProgressOverlayOnQuestIcon(name, _local1, this.m_arrowPersists);
                    this.m_botherCount++;
                };
            };
        }
        protected function hasBeenUpdated():Boolean{
            return (((this.m_questUpdatedTime) && (TimestampEvents.checkTimestampAfterUnixTime(this.m_questUpdatedTime, (Global.player.getLastActivationTime(name) * 1000)))));
        }
        public function getRewards():Object{
            var _local4:XMLList;
            var _local5:int;
            var _local6:String;
            var _local1:Object = {};
            var _local2 = 1;
            var _local3:int = Global.experimentManager.getVariant(ExperimentDefinitions.EXPERIMENT_QUEST_PAYOUT_MULTIPLE);
            if (_local3){
                _local2 = _local3;
            };
            _local2 = (_local2 * Math.min(this.getRewardMultiplier(this.m_rewardMultiplier), this.m_rewardMultiplierMax));
            if (this.m_resourceMods){
                _local4 = this.m_resourceMods.attributes();
                _local5 = 0;
                while (_local5 < _local4.length()) {
                    _local6 = _local4[_local5].name().toString();
                    switch (_local6){
                        case "xp":
                        case "gold":
                        case "goods":
                        case "energy":
                            _local1[_local6] = String((int(_local4[_local5].toString()) * _local2));
                            break;
                        default:
                            _local1[_local6] = _local4[_local5].toString();
                    };
                    _local5++;
                };
            };
            return (_local1);
        }
        protected function getRewardMultiplier(_arg1:String):Number{
            var _local2:Number = 1;
            switch (_arg1){
                case "minigameScore":
                    if (MiniGame.getMiniGame()){
                        _local2 = MiniGame.getMiniGame().getResults().score;
                    };
                    break;
            };
            return (_local2);
        }
        function updateProgressFlag():void{
            var _local1:Object = Global.questManager.getQuestProgressByName(this.name);
            if (_local1 == null){
                return;
            };
            var _local2:Array = (_local1.progress as Array);
            var _local3:int;
            var _local4:int;
            while (_local4 < _local2.length) {
                _local3 = (_local3 + _local2[_local4]);
                _local4++;
            };
            this.m_everLookedAt = (_local3 > 0);
        }
        function awardQuestRewards():void{
            Global.player.giveRewards(this.getRewards(), true);
        }
        public function addToQuestBar():void{
            var flag:* = null;
            var bitmap:* = null;
            var animatingIcon:* = null;
            if (((((((((this.m_icon) && (name))) && (this.m_toolTip))) && (Global.player.allowQuests()))) && (!(this.m_hideIcon)))){
                bitmap = (this.m_icon as Bitmap);
                if (((this.m_animateIcon) && (bitmap))){
                    animatingIcon = new AutoAnimatedBitmap(bitmap.bitmapData, this.m_animationObject.numFrames, this.m_animationObject.frameWidth, this.m_animationObject.frameHeight, this.m_animationObject.fps);
                    animatingIcon.play();
                    Global.hud.addQuestSprite(name, animatingIcon, this.m_toolTip);
                } else {
                    Global.hud.addQuestSprite(name, this.m_icon, this.m_toolTip);
                };
                if (((((this.m_autoShowPopup) || (this.m_autoShowOnce))) && (!(Global.isVisiting())))){
                    if (((!(this.m_autoShowOnce)) || ((Global.player.getLastActivationTime(name) == -1)))){
                        TimerUtil.callLater(function ():void{
                            Global.questManager.pumpActivePopup(name);
                        }, NEWSPAPER_AUTOPOP_WAIT);
                        this.m_autoShowPopup = false;
                    };
                };
                this.showInitialGoalOverlay();
            };
            for each (flag in this.m_uxFlags) {
                Global.questManager.unlockUX(flag);
            };
        }
        private function checkBotherTimer():void{
            var _local1 = (Global.gameSettings.getString("questAllowBother", "true") == "true");
            if (((!(this.m_everLookedAt)) && (_local1))){
                this.m_timer = new Timer(Global.gameSettings.getInt("questBotherTime", 30000), 0);
                this.m_timer.addEventListener(TimerEvent.TIMER, this.onBotherTimerComplete);
                this.m_timer.start();
            };
        }
        private function onBotherTimerComplete(_arg1:TimerEvent=null):void{
            if (this.m_timer != null){
                this.m_timer.stop();
                this.m_timer.removeEventListener(TimerEvent.TIMER, this.onBotherTimerComplete);
                this.m_timer = null;
            };
            if (!this.m_everLookedAt){
                Global.hud.showGoalsProgressOverlayOnQuestIcon(name, this.getProgressOverlayType());
                this.m_botherCount++;
            };
            this.checkBotherTimer();
        }
        private function getProgressOverlayType():String{
            if (this.m_popNews){
                return ("news");
            };
            if ((((this.m_botherCount & 1)) && (!((this.m_botherCount == this.INITIAL_BOTHER))))){
                return ("click");
            };
            return ("goals");
        }
        private function getNotificationOverlayType():String{
            var _local1:Object;
            if (this.m_notifications.length > 0){
                _local1 = this.m_notifications[0];
                if (((_local1.hasOwnProperty("experiment")) && (_local1.hasOwnProperty("variant")))){
                    if (Global.experimentManager.getVariant(_local1["experiment"]) == _local1["variant"]){
                        return (_local1["type"]);
                    };
                } else {
                    return (_local1["type"]);
                };
            };
            return (null);
        }
        private function getUpdateOverlayType():String{
            return ("update");
        }
        public function getSequels():Vector.<String>{
            var _local2:XML;
            var _local1:Vector.<String> = new Vector.<String>();
            for each (_local2 in m_xml.sequels.sequel) {
                _local1.push(_local2.@name);
            };
            return (_local1);
        }
        public function getRewardsData():Array{
            var resource:* = null;
            var rewardList:* = null;
            var reward:* = null;
            var url:* = null;
            var amount:* = 0;
            var itemName:* = null;
            var loc:* = null;
            var rewardsDef:* = this.getRewards();
            var rewards:* = [];
            var i:* = 0;
            for (resource in rewardsDef) {
                rewardList = null;
                if (m_xml.rewards.reward.hasOwnProperty("@name")){
                    rewardList = m_xml.rewards.reward.(@name == resource);
                };
                reward = null;
                if (((rewardList) && ((rewardList.length() > 0)))){
                    reward = rewardList[0];
                } else {
                    reward = m_xml.rewards.reward[i];
                };
                if (reward){
                    if (reward.@silent == "true"){
                        continue;
                    };
                    url = reward.@url;
                    amount = int(rewardsDef[resource]);
                    itemName = null;
                    if (resource == "item"){
                        itemName = reward.@itemName;
                        if ((((itemName == null)) || ((itemName == "")))){
                            itemName = rewardsDef[resource];
                        };
                    } else {
                        itemName = reward.@itemName;
                    };
                    loc = String(reward.@loc);
                    rewards.push({
                        resource:resource,
                        amount:amount,
                        url:url,
                        itemName:itemName,
                        loc:loc
                    });
                };
                i = (i + 1);
            };
            return (rewards);
        }
        public function getPopupData():Object{
            var _local1:Object = Global.questManager.getQuestProgressByName(this.name);
            if (_local1 == null){
                return (null);
            };
            var _local2:Array = this.getRewardsData();
            var _local3:Object = new Object();
            _local3.guide = this.m_guide;
            var _local4:Object = this.getFirstIncompleteTask();
            if (_local4 != null){
                _local3.guideName = _local4.guide;
            };
            _local3.name = name;
            _local3.url = this.icon;
            _local3.intro = m_xml.intro;
            _local3.tasks = m_xml.tasks.task;
            _local3.taskFooters = m_xml.taskFooters;
            _local3.npcName = m_xml.npc.@name;
            _local3.npcIntroUrl = m_xml.npc.intro.@url;
            _local3.npcActiveUrl = m_xml.npc.active.@url;
            _local3.npcCompleteUrl = m_xml.npc.complete.@url;
            _local3.finishIcon = m_xml.rewards.@icon_url;
            _local3.rewards = _local2;
            _local3.progress = _local1.progress;
            _local3.customPickUrl = this.m_customPickUrl;
            _local3.isEpilogueData = false;
            _local3.introCloseCallback = this.introCloseCallback;
            var _local5:MiniGame = MiniGame.getMiniGame();
            if (_local5){
                _local3.minigameResults = _local5.getResults();
            };
            return (_local3);
        }
        public function getEpiloguePopupData():Array{
            var _local2:XML;
            var _local3:Object;
            var _local4:XML;
            var _local1:Array = new Array();
            for each (_local2 in m_xml.customDialogs.epilogueDialog) {
                _local3 = new Object();
                for each (_local4 in _local2.@*) {
                    if (_local4.name() != "className"){
                        _local3[_local4.name().toString()] = _local4.toString();
                    };
                };
                _local3.isEpilogueData = true;
                _local1.push(_local3);
            };
            return (_local1);
        }
        public function doQuestCompleteConsumptions():void{
            var _local1:XML;
            var _local2:String;
            var _local3:String;
            var _local4:int;
            for each (_local1 in this.m_consumption) {
                _local2 = _local1.@type;
                _local3 = _local1.@name;
                _local4 = int(_local1.@number);
                switch (_local2){
                    case "resource":
                        if (_local3 == "coin"){
                            Global.player.gold = (Global.player.gold - _local4);
                        } else {
                            if (_local3 == "goods"){
                                Global.player.commodities.remove("goods", _local4);
                            };
                        };
                        break;
                    case "inventory":
                        Global.player.inventory.removeItems(_local3, _local4);
                        break;
                };
            };
        }
        public function doQuestCompleteUxUnlocks():void{
            var _local1:String;
            for each (_local1 in this.m_uxFlagsComplete) {
                Global.questManager.unlockUX(_local1);
            };
        }
        public function doQuestExpired():void{
            if (!this.m_isActive){
                return;
            };
            if (this.m_hasCompleted){
                return;
            };
            Global.hud.removeQuestSprite(name);
        }
        public function hasConsumptions():Boolean{
            return (this.m_hasConsumptions);
        }
        public function get iconDisplayObject():DisplayObject{
            return (this.m_icon);
        }
        public function getCustomQuestDialog():Class{
            if (this.m_customQuestDialog){
                return ((getDefinitionByName(("Modules.quest.Display." + this.m_customQuestDialog)) as Class));
            };
            return (null);
        }
        public function getCustomQuestCompleteDialog():Class{
            if (((this.m_customQuestCompleteDialog) && (!((this.m_customQuestCompleteDialog == this.DO_NOT_SHOW_COMPLETE))))){
                return ((getDefinitionByName(("Modules.quest.Display." + this.m_customQuestCompleteDialog)) as Class));
            };
            return (null);
        }
        public function getEpilogueDialogs():Array{
            var _local1:Array;
            var _local2:String;
            if (this.m_epilogueDialogs.length > 0){
                _local1 = [];
                for each (_local2 in this.m_epilogueDialogs) {
                    _local1.push((getDefinitionByName(("Modules.quest.Display." + _local2)) as Class));
                };
                return (_local1);
            };
            return (null);
        }
        public function shouldShowPopup(_arg1:Boolean):Boolean{
            if (((_arg1) && ((this.m_showCompleteDialog == false)))){
                return (false);
            };
            var _local2 = !((((tasks.length == 1)) && ((tasks[0].action == "popNews"))));
            var _local3:Boolean;
            return (((((_arg1) && (_local2))) || (((!(_arg1)) && (_local3)))));
        }
        public function resetQuestIcon():void{
            var _local1:String;
            if (this.icon != String(m_xml.@url)){
                this.m_iconUrl = String(m_xml.@url);
                _local1 = Global.getAssetURL(this.icon);
                LoadingManager.load(_local1, this.swapQuestIconLoaded);
            };
        }
        private function swapQuestIconLoaded(_arg1:Event):void{
            var _local4:Loader;
            var _local2:Object = Global.questManager.getQuestProgressByName(this.name);
            var _local3 = (_local2 == null);
            if (((this.visible) && (!(_local3)))){
                _local4 = (_arg1.target.loader as Loader);
                this.m_icon = _local4.content;
                Global.hud.removeQuestSprite(name, false);
                this.addToQuestBar();
            };
        }
        protected function getTaskIndexByAction(_arg1:String, _arg2:XMLList):int{
            var _local3:int;
            while (_local3 < _arg2.length()) {
                if (_arg2[_local3].@action == _arg1){
                    return (_local3);
                };
                _local3++;
            };
            return (-1);
        }
        public function hasDoneTask(_arg1:String, _arg2:XMLList, _arg3:Object):Boolean{
            var _local4:int = this.getTaskIndexByAction(_arg1, _arg2);
            if (_arg3[_local4] < Number(_arg2[_local4].@total)){
                return (false);
            };
            return (true);
        }
        public function isQuestComplete():Boolean{
            var _local3:Object;
            var _local1:Object = Global.questManager.getQuestProgressByName(this.name);
            var _local2:int;
            while (_local2 < this.tasks.length) {
                _local3 = this.tasks[_local2];
                if (_local1.progress[_local2] < _local3.total){
                    return (false);
                };
                _local2++;
            };
            return (true);
        }
        public function getFirstIncompleteTask():Object{
            var _local3:Object;
            var _local1:Object = Global.questManager.getQuestProgressByName(this.name);
            if (_local1 == null){
                return (null);
            };
            var _local2:int;
            while (_local2 < this.tasks.length) {
                _local3 = this.tasks[_local2];
                if (_local1.progress[_local2] < _local3.total){
                    return (_local3);
                };
                _local2++;
            };
            return (null);
        }
        public function updateGuide():void{
            if (this.m_guide){
                this.m_guide.update();
            };
        }
        override public function get icon():String{
            return (this.m_iconUrl);
        }
        public function get hasIntro():Boolean{
            return (this.m_hasIntro);
        }
        public function get popNews():Boolean{
            return (this.m_popNews);
        }
        public function get newsImageUrl():String{
            return (this.m_newsImageUrl);
        }
        public function get completeWaitTime():Number{
            return (this.m_completeWaitTime);
        }
        public function get questUpdatedTime():String{
            return (this.m_questUpdatedTime);
        }
        public function get hideIcon():Boolean{
            return (this.m_hideIcon);
        }
        public function set hideIcon(_arg1:Boolean):void{
            this.m_hideIcon = _arg1;
        }
        public function set hasCompleted(_arg1:Boolean):void{
            this.m_hasCompleted = _arg1;
        }
        public function get hasCompleted():Boolean{
            return (this.m_hasCompleted);
        }
        public function get introCloseCallback():Function{
            return (this.m_introCloseCallback);
        }
        public function get completionCallback():Function{
            return (this.m_completionCallback);
        }

    }
}//package Modules.quest.Managers 
